/**
 * 全局数据定义
 */
export const PropertyPanelType = {
	Property: "property",
	DataSource: "dataSource", // 这个字段为保留资源
	Events: "events" // 这个字段为保留资源
};

/**
 * 此属性主要处理PropertyType为UIData的数据，动态渲染
 */
export const PropertyTypeUIData = {
	Button: "Button"
};

/**
 * 属性类型定义
 */
export const PropertyType = {
	Number: "number", // 数字
	String: "string", // 字符串
	Boolean: "bool", // 布尔
	Array: "array", // 数组 普通数据
	ArrayType: "arrayType", // 下拉类型
	Object: "object", // 对象
	Color: "color", // 字符串
	Image: "image", // 字符串
	File: "file", // 字符串
	Font: "font", // 字符串
	Data: "data", // 字符串,
	UIData: "uidata",
	Custom: "custom"
};

/**
 * border属性定义
 */
export const PropertyBorderType = {
	None: "none",
	Solid: "solid",
	Dashed: "dashed",
	Dotted: "dotted",
	Double: "double"
};

/**
 * 数据源类型定义
 */
export const PropertyDataSourceType = {
	Static: 0,
	Dynamic: 1,
	Request: 2,
	DataBase: 3,
	Custom: 4
};

/**
 * 所有已知属性定义
 */
export const AllPropertyDefine = {
	uuid: {
		type: PropertyType.String,
		label: "uuid",
		name: "uuid",
		default: "",
		disabled: true,
		hidden: true,
		style: ""
	},
	x: {
		type: PropertyType.Number,
		label: "x",
		name: "x",
		default: 100,
		disabled: false,
		hidden: false,
		style: ""
	},
	y: {
		type: PropertyType.Number,
		label: "y",
		name: "y",
		default: 100,
		disabled: false,
		hidden: false,
		style: ""
	},
	w: {
		type: PropertyType.Number,
		label: "w",
		name: "w",
		default: 100,
		disabled: false,
		hidden: false,
		style: ""
	},
	h: {
		type: PropertyType.Number,
		label: "h",
		name: "h",
		default: 100,
		disabled: false,
		hidden: false,
		style: ""
	},
	minW: {
		type: PropertyType.Number,
		label: "最小宽",
		name: "minW",
		default: 100,
		disabled: false,
		hidden: false,
		style: "",
		tips: ""
	},
	minH: {
		type: PropertyType.Number,
		label: "最小高",
		name: "minH",
		default: 100,
		disabled: false,
		hidden: false,
		style: "",
		tips: ""
	},
	maxW: {
		type: PropertyType.Number,
		label: "最大宽",
		name: "maxW",
		default: 2000,
		disabled: false,
		hidden: false,
		style: "",
		tips: ""
	},
	maxH: {
		type: PropertyType.Number,
		label: "最大高",
		name: "maxH",
		default: 2000,
		disabled: false,
		hidden: false,
		style: "",
		tips: ""
	},
	rotate: {
		type: PropertyType.Number,
		label: "旋转度数",
		name: "rotate",
		default: 0,
		disabled: false,
		hidden: false,
		style: "",
		tips: ""
	},
	hidden: {
		type: PropertyType.Boolean,
		label: "隐藏",
		name: "hidden",
		default: false,
		disabled: false,
		hidden: false,
		style: "",
		tips: ""
	},
	disabled: {
		type: PropertyType.Boolean,
		label: "禁用",
		name: "disabled",
		default: false,
		disabled: false,
		hidden: false,
		style: "",
		tips: ""
	},
	margin: {
		type: PropertyType.Array,
		label: "外边距",
		name: "margin",
		default: [0, 0, 0, 0],
		disabled: false,
		hidden: false,
		style: "",
		tips: "格式：[上,右,下,左]"
	},
	padding: {
		type: PropertyType.Array,
		label: "内边距",
		name: "padding",
		default: [0, 0, 0, 0],
		disabled: false,
		hidden: false,
		style: "",
		tips: "格式：[上,右,下,左]"
	},
	border: {
		type: PropertyType.Array,
		label: "边框",
		name: "border",
		default: [
			{
				width: 1,
				type: PropertyBorderType.Solid,
				color: "#eee"
			},
			{
				width: 1,
				type: PropertyBorderType.Solid,
				color: "#eee"
			},
			{
				width: 1,
				type: PropertyBorderType.Solid,
				color: "#eee"
			},
			{
				width: 1,
				type: PropertyBorderType.Solid,
				color: "#eee"
			}
		],
		disabled: false,
		hidden: false,
		style: "",
		tips: "格式：[上,右,下,左], 无边框则值为空"
	},
	fontColor: {
		type: PropertyType.Color,
		label: "字体颜色",
		name: "fontColor",
		default: "#000",
		disabled: false,
		hidden: false,
		style: "",
		tips: "字体颜色"
	},
	fontFamily: {
		type: PropertyType.Font,
		label: "字体类型",
		name: "fontFamily",
		default: "微软雅黑",
		disabled: false,
		hidden: false,
		style: "",
		tips: "字体类型"
	},
	fontSize: {
		type: PropertyType.Number,
		label: "字体大小",
		name: "fontSize",
		default: "32",
		disabled: false,
		hidden: false,
		style: "",
		tips: "字体大小"
	},
	fontWeight: {
		type: PropertyType.String,
		label: "字体粗细",
		name: "fontWeight",
		default: "normal",
		disabled: false,
		hidden: false,
		style: "",
		tips: "字体粗细"
	},
	fontAlign: {
		type: PropertyType.String,
		label: "对齐方式",
		name: "fontAlign",
		default: "left",
		disabled: false,
		hidden: false,
		style: "",
		tips: "对齐方式"
	},
	textAlign: {
		type: PropertyType.String,
		label: "排列",
		name: "textAlign",
		default: "left",
		disabled: false,
		hidden: false,
		style: "",
		tips: "值：left/center/right"
	},
	textDecoration: {
		type: PropertyType.String,
		label: "修饰",
		name: "textDecoration",
		default: "none",
		disabled: false,
		hidden: false,
		style: "",
		tips: "值：none/underline/overline/line-through"
	},
	textIndent: {
		type: PropertyType.Number,
		label: "文本缩进",
		name: "textIndent",
		default: 2,
		disabled: false,
		hidden: false,
		style: "",
		tips: "例如： 2, 表示缩进2个字符"
	},
	lineHeight: {
		type: PropertyType.Number,
		label: "行高",
		name: "lineHeight",
		default: 1,
		disabled: false,
		hidden: false,
		style: "",
		tips: "例如： 15, 表示行高15px"
	},
	backgroundColor: {
		type: PropertyType.Color,
		label: "背景颜色",
		name: "backgroundColor",
		default: "#2c374b",
		disabled: false,
		hidden: false,
		style: "",
		tips: ""
	},
	backgroundImage: {
		type: PropertyType.Image,
		label: "背景图片",
		name: "backgroundImage",
		default: "",
		disabled: false,
		hidden: false,
		style: "",
		tips: ""
	},
	opacity: {
		type: PropertyType.Number,
		label: "透明度",
		name: "opacity",
		default: 100,
		disabled: false,
		hidden: false,
		style: "",
		tips: ""
	},
	zIndex: {
		type: PropertyType.Number,
		label: "层索引",
		name: "zIndex",
		default: 0,
		disabled: false,
		hidden: false,
		style: "",
		tips: ""
	},
	styleSheet: {
		type: PropertyType.String,
		label: "自定义样式",
		name: "styleSheet",
		default: "",
		disabled: false,
		hidden: false,
		style: "",
		tips: ""
	}
};

const ComPropertyDefine = () => {
	const allKeys = Object.keys(AllPropertyDefine);
	const allKeysObj = {};
	allKeys.forEach(item => {
		allKeysObj[item] = item;
	});

	const pArr = [];
	pArr.push(allKeysObj.uuid);
	pArr.push(allKeysObj.x);
	pArr.push(allKeysObj.y);
	pArr.push(allKeysObj.w);
	pArr.push(allKeysObj.h);
	pArr.push(allKeysObj.backgroundColor);
	pArr.push(allKeysObj.opacity);
	pArr.push(allKeysObj.zIndex);
	return pArr;
};

export { ComPropertyDefine };
